﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;

namespace DNA.Mvc
{
    /// <summary>
    /// Defines methods to manipulate the OpenID
    /// </summary>
    public interface IOpenIDRepository:IRepository<OpenIdentity>
    {
        /// <summary>
        /// Binding a new OpenID account to user.
        /// </summary>
        /// <param name="userName">Specified the target user name.</param>
        /// <param name="openid">Specified the OpenID account.</param>
        /// <returns>Returns true when successful.</returns>
        bool AddOpenID(string userName, string openid);

        /// <summary>
        /// Unbind and remove OpenID from user account.
        /// </summary>
        /// <param name="userName">Specified the target user name.</param>
        /// <param name="openid">Specified the OpenID account.</param>
        void DeleteOpenID(string userName, string openid);

        /// <summary>
        /// Gets the OpenIdenity objects by specified user name.
        /// </summary>
        /// <param name="userName">Specified the user name.</param>
        /// <returns>Returns the OpenIdentity collction for specified user.</returns>
        IEnumerable<OpenIdentity> GetUserIDs(string userName);

        /// <summary>
        /// Gets a MembershipUser instance by specified openId account.
        /// </summary>
        /// <param name="openId">Specified the openid.</param>
        /// <returns>Returns the MembershipUser instance for searched user.</returns>
        MembershipUser Find(string openId);
    }
}
